package dao

import "go_payment/model"

func GetMemberInfoById(memberId int) model.Member {
	sql := "SELECT id,authorized,apikey,status,balance,pre_balance FROM pay_member WHERE id = ? LIMIT 1"
	stmt, err := db.Prepare(sql)
	defer stmt.Close()
	if err != nil {
		panic(err)
	}
	row := stmt.QueryRow(memberId)
	var member model.Member
	err = row.Scan(&member.ID, &member.Authorized, &member.Apikey, &member.Status, &member.Balance, &member.PreBalance)
	if err != nil {
		panic(err)
	}
	return member
}
